package com.创建型模型.D单例模式;

/**通过静态内部类实现单例,静态内部类只能在第一次被调用时候加载一次
 *  * @author zhangjiawen
 * @Date: 2022/6/1 11:20
 */
public class LazyManInnerStatic {


    private LazyManInnerStatic(){}

    public static LazyManInnerStatic getInstance(){
        return SingleBean.lazyManInnerStatic;
    }

    public static class SingleBean{
        private final static LazyManInnerStatic lazyManInnerStatic=new LazyManInnerStatic();

    }


    public static void main(String[] args) {
        LazyManInnerStatic instance = LazyManInnerStatic.getInstance();
        System.out.println(instance);
    }

}
